<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>

<body class="hold-transition skin-blue sidebar-mini">
<section class="content">
    <div class="row" style="margin-bottom: 24px">
        <button class="btn btn-info pull-right" onclick="Print('#print')">打印</button>
    </div>
    <form id="sheetForm" class="form-horizontal">
        <div class="row">
                <div class="col-xs-11" style="margin-left: 4%;">
                    <div id="print">
                        <table class="t1">
                            <thead>
                            <tr>
                                <td colspan="9">
                                    <img th:src="@{/img/logo3.jpg}" width="64px" height="40px" style="margin-top: -20px">
                                    <div style="display: inline-block;margin-top: 5px;margin-left: 20px">
                                        <span style="letter-spacing: 24px;display: block;line-height: 20px">&nbsp;辽宁忠旺机械设备制造有限公司</span>
                                        <span style="display: block;font-size: 12px;line-height: 20px">Liaoning Zhongwang Machinery Equipment Manufacturing Co., Ltd</span>
                                    </div>
                                </td>
                                <td colspan="2">装配派工单</td>
                                <td rowspan="4" style="width: 12%">
                                    <div id="qrCode-div" style="display: none"></div>
                                    <img id="qr-img" width="100" height="100">
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 6%">生产令号</td>
                                <td style="width: 11%">
                                    [[${asse.prodNo}]]
                                </td>
                                <td style="width: 7.3%">项目名称</td>
                                <td colspan="2">
                                    [[${asse.proName}]]
                                </td>
                                <td style="width: 6%">订单数量</td>
                                <td style="width: 7%">
                                    [[${asse.proNum}]]
                                </td>
                                <td style="width: 9.1%">类型</td>
                                <td style="width: 6.9%">
                                    [[${asse.special}]]
                                </td>
                                <td style="width: 7.9%">部分</td>
                                <td style="width: 9.8%">
                                    [[${asse.part}]]
                                </td>
                            </tr>
                            <tr>
                                <td rowspan="2">装配图号</td>
                                <td colspan="2" rowspan="2">
                                    [[${asse.drawNo}]]
                                </td>
                                <td rowspan="2" style="width: 6%">装配名称</td>
                                <td colspan="3" rowspan="2">
                                    [[${asse.drawName}]]
                                </td>
                                <td>装配数量</td>
                                <td>
                                    [[${asse.drawNum}]]
                                </td>
                                <td rowspan="2">要求完成时间</td>
                                <td rowspan="2">
                                    [[${asse.compTime}]]
                                </td>
                            </tr>
                            <tr>
                                <td>重量Kg</td>
                                <td>
                                    [[${asse.drawWeight}]]
                                </td>
                            </tr>
                            <tr>
                                <td>部门</td>
                                <td style="text-align: left;padding-left: 10px;" colspan="11">
                                    [[${asse.deptName}]]
                                </td>
                            </tr>
                            <tr>
                                <td>路线</td>
                                <td>序号</td>
                                <td>工序</td>
                                <td colspan="9">工艺内容</td>
                            </tr>
                            </thead>
                            <tbody id="card">
                            <tr th:each="d : ${details}">
                                <td>
                                    [[${d.route}]]
                                </td>
                                <td>
                                    [[${d.orderNo}]]
                                </td>
                                <td>
                                    [[${d.process}]]
                                </td>
                                <td colspan="9" style="text-align:left;padding-left: 5px;">
                                    <div th:utext="${d.comment}"></div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <div style="font-size: 14px;line-height: 200%;margin-left: 4%;">
                            <div class="col-xs-3" style="padding-left: 0">提报人： [[${asse.createName}]]&nbsp;&nbsp;[[${#dates.format(asse.createTime,'yyyy.MM.dd')}]]</div>
                            <div class="col-xs-3 bottom form-inline">联系电话：[[${asse.createTel}]]</div>
                        </div>
                    </div>
                </div>
            </div>
    </form>
    <br>
    <hr>
    <div class="row">
        <div class="col-xs-11" style="margin-left: 4%;">
            <h4 class="pull-right" style="margin-bottom: 10px;margin-right: 50%;">装配零件信息</h4>
            <table id="bootstrap-one-table"></table>
        </div>
    </div>
    <br>
    <hr>
    <div class="row">
        <div class="col-xs-12" style="margin-left: 4%;padding-right: 9%;">
            <h4 class="pull-right" style="margin-bottom: 10px;margin-right: 50%;">装配外购件信息</h4>
            <form id="buyForm" class="form-horizontal">
                <table class="t1 t3">
                    <thead>
                    <tr>
                        <td style="width: 4%">序号</td>
                        <td style="width: 25%">物料名称</td>
                        <td style="width: 13%">跟踪号</td>
                        <td style="width: 7%">使用数量</td>
                        <td style="width: 5%">单位</td>
                        <td style="width: 10%">回货状态</td>
                        <td>存放位置</td>
                        <td>备注</td>
                        <td></td>
                    </tr>
                    </thead>
                    <tbody id="out">
                    <tr th:each="d : ${buyList}">
                        <td th:text="${dStat.count}"></td>
                        <td th:text="${d.matNameDesc}"></td>
                        <td th:text="${d.trackCode}"></td>
                        <td th:text="${d.useNum}"></td>
                        <td th:text="${d.unit}"></td>
                        <td th:text="${d.backStatus}"></td>
                        <td th:text="${d.position}"></td>
                        <td th:text="${d.comment}"></td>
                        <td></td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    let table1;

    let gloDeptName = toUtf8([[${asse.prodNo}]] + '|' + [[${asse.drawNo}]] + '|' + [[${asse.partId}]] + '|2');

    $("#qrCode-div").qrcode({
        width: 80,
        height: 80,
        text: gloDeptName
    });

    $(function () {

        let c = document.getElementsByTagName('canvas')[0];
        $("#qr-img").attr("src", c.toDataURL("image/png"));

        /** 零件列表 */
        table1 = js.table.init({
            id: "bootstrap-one-table",
            url: ctx + "assemble/assMake/makePieceList",
            showExport: false,
            pageSize: 20,
            queryData: {
                asseAssemblySheetId: [[${asse.id}]],
            },
            columns: [
                {
                    title: '序号', field: 'id', width: '50',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: "零件图号", field: 'drawNo'},
                {title: "零件名称", field: 'drawName'},
                {title: "图纸类型", field: 'drawType'},
                {title: "使用数量", field: 'useNum'},
                {title: "质检意见", field: 'comment'},
                {title: "保存时间", field: 'commitTime'}
            ]
        });

    })

</script>
</body>
</html>
